import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_getx_cms/utils/locale_controller.dart';
import 'package:flutter_getx_cms/utils/state_controller.dart';
import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
import 'app.dart';
import 'env.dart';
import 'isar/db_manager.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  DatabaseManager.getInstance().initDb(); //本地数据库初始化

  TDTheme.needMultiTheme(); //多主题
  String themeJSON = await rootBundle.loadString('assets/theme.json');

  Get.put(LocaleController());
  Get.put(StateController());

  BuildEnvironment.init(BuildFlavor.prod, 'https://cms-app.sunda.com');

  runApp(MyApp(
    themeJSON: themeJSON,
  ));
}

